<?php
/**
 * 商品
 * Enter description here ...
 * @author nijn
 *
 */
class GoodsController extends ShopController{
	public $modelName = 'Goods';
	public $defaultAction = 'list';
	/**
	 * listAction 列表
	 * viewAction 详情
	 */
	
	public function actions() {
		$provider = $this->getProvider();
		return array(
			'list' => array(
				'class' => 'application.components.actions.front.ListAction',
				'criteria' => array(
					'condition' => 't.provider_id = :uid',
					'params' => array(
						':uid' => $provider->id
					),
				),
				'data' => array(
					'provider' => $provider
				)
			),
			'ticketView' => array(
				'class' => 'application.components.actions.front.ViewAction',
				'view' => 'ticketView',
				'modelName' => 'Ticket',
			),
			'scenicView' => array(
				'class' => 'application.components.actions.front.ViewAction',
				'view' => 'scenicView',
				'modelName' => 'Scenic',
			),
			'hotelView' => array(
				'class' => 'application.components.actions.front.ViewAction',
				'view' => 'hotelView',
				'modelName' => 'Hotel',
			),
			'travelView' => array(
				'class' => 'application.components.actions.front.ViewAction',
				'view' => 'travelView',
				'modelName' => 'Travel',
			),
			'nativeView' => array(
				'class' => 'application.components.actions.front.ViewAction',
				'view' => 'nativeView',
				'modelName' => 'Native',
			),
		); 	
	}
	
	public function actionAgentGoods($id) {
		$adminUser = Yii::app()->adminUser;
		$related = AgentRelated::model()->related($adminUser->id, $this->provider->id);
		if (CHtml::value($related, 'status') == 'ST_PASSED')
			GoodsAgentRelated::agent($this->provider->id, $id, $adminUser->id);
		CControllerHelper::redirectReferrer();
	}
	
}

?>